package jdbc;

import java.sql.Connection;
import java.sql.Statement;

/**
 * 创建一张表article
 * 表结构
 *  id 整数类型，主键，自增           唯一标识
 *  title 字符串类型，长度200个字符     文章标题
 *  content 字符串类型，长度1000个字符  文章正文
 */
public class Test {
    public static void main(String[] args) {
        try (Connection connection = DBUtil.getConnection()){
            Statement statement = connection.createStatement();
            String sql="create table article(" +
                    " id int(3) auto_increment primary key," +
                    " title varchar(200), " +
                    " content varchar(1000) " +
                    ")";
            statement.execute(sql);
                System.out.println("创建表成功");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
